/*
 * @Author: szx
 * @Date: 2022-03-03 12:50:49
 * @LastEditTime: 2022-03-03 12:55:35
 * @Description:
 * @FilePath: \leetcode\200-299\258\258.js
 */
/**
 * @param {number} num
 * @return {number}
 */
var addDigits = function (num) {
    while (num > 10) {
        let sum = 0;
        while (num > 0) {
            sum += num % 10;
            num = Math.floor(num / 10);
        }
        num = sum;
    }
    return num;
};
